Telegram Group & Telegram Channel
Магия нового помощника defer() в Laravel

Недавно в Laravel был добавлен новый помощник под названием defer(), который можно использовать для отложения выполнения обратного вызова до тех пор, пока успешный ответ не будет отправлен.

Таким образом, вы можете перенести трудоемкую работу (например, вызов внешнего API) в обратный вызов и вернуть ответ пользователю как можно быстрее.

Вот как это выглядит.


Route::get('/defer', function () {
defer(function () {
// do time-consuming work here
sleep(10);
});

return "Hello world";
});


https://www.amitmerchant.com/the-magic-behind-laravels-new-defer-helper/

👉 @php_lib
👍3😁2



tg-me.com/php_lib/633
Create:
Last Update:

Магия нового помощника defer() в Laravel

Недавно в Laravel был добавлен новый помощник под названием defer(), который можно использовать для отложения выполнения обратного вызова до тех пор, пока успешный ответ не будет отправлен.

Таким образом, вы можете перенести трудоемкую работу (например, вызов внешнего API) в обратный вызов и вернуть ответ пользователю как можно быстрее.

Вот как это выглядит.


Route::get('/defer', function () {
defer(function () {
// do time-consuming work here
sleep(10);
});

return "Hello world";
});


https://www.amitmerchant.com/the-magic-behind-laravels-new-defer-helper/

👉 @php_lib

BY Библиотека PHP программиста 👨🏼‍💻👩‍💻




Share with your friend now:
tg-me.com/php_lib/633

View MORE
Open in Telegram


Библиотека PHP программиста ‍‍ Telegram | DID YOU KNOW?

Date: |

How Does Bitcoin Work?

Bitcoin is built on a distributed digital record called a blockchain. As the name implies, blockchain is a linked body of data, made up of units called blocks that contain information about each and every transaction, including date and time, total value, buyer and seller, and a unique identifying code for each exchange. Entries are strung together in chronological order, creating a digital chain of blocks. “Once a block is added to the blockchain, it becomes accessible to anyone who wishes to view it, acting as a public ledger of cryptocurrency transactions,” says Stacey Harris, consultant for Pelicoin, a network of cryptocurrency ATMs. Blockchain is decentralized, which means it’s not controlled by any one organization. “It’s like a Google Doc that anyone can work on,” says Buchi Okoro, CEO and co-founder of African cryptocurrency exchange Quidax. “Nobody owns it, but anyone who has a link can contribute to it. And as different people update it, your copy also gets updated.”

Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new app—funded with the proceeds from the VK sale—less as a business than as a way for people to send messages while avoiding government surveillance and censorship.

Библиотека PHP программиста ‍‍ from sg


Telegram Библиотека PHP программиста 👨🏼‍💻👩‍💻
FROM USA